package com.zycfc.zsf.boot.util.json;

import com.google.gson.*;
import java.io.*;
import com.google.gson.stream.*;

public class StringNullAdapter extends TypeAdapter<String>
{
    public String read(final JsonReader reader) throws IOException {
        if (reader.peek() == JsonToken.NULL) {
            reader.nextNull();
            return "";
        }
        return reader.nextString();
    }
    
    public void write(final JsonWriter writer, final String value) throws IOException {
        if (value == null) {
            writer.value("");
            return;
        }
        writer.value(value);
    }
}
